package com.qumitech.visualnovel.controller.rest.novel;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.qumitech.visualnovel.model.common.BaseResponse;
import com.qumitech.visualnovel.model.dto.RoleAddDTO;
import com.qumitech.visualnovel.model.dto.RoleUpdateDTO;
import com.qumitech.visualnovel.model.dto.RoleQueryDTO;
import com.qumitech.visualnovel.service.novel.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;

@RestController
@Api(value = "角色管理模块", description = "小说角色api")
public class RoleRest {
    @Autowired
    private RoleService roleService;

    @ApiOperation(value = "创建角色", notes = "创建角色")
    @PutMapping("/api/role")
    public BaseResponse create(@RequestBody RoleAddDTO body) {
        return roleService.create(body);
    }

    @ApiOperation(value = "修改角色", notes = "修改角色")
    @PostMapping("/api/role")
    public BaseResponse update(@RequestBody RoleUpdateDTO body) {
        return roleService.update(body);
    }

    @ApiOperation(value = "查询角色列表", notes = "查询角色列表")
    @GetMapping("/api/role/list")
    public BaseResponse list(RoleQueryDTO param) {
        return roleService.list(param);
    }
}
